home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7547 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  59 lines

  1. Newsgroups: comp.lang.c++
  2. Path: newsfeed.acns.nwu.edu!ftpbox!mothost!mdisea!pilchuck!news
  3. From: Meiyu Lin <linm@data-io.com>
  4. Subject: Re: Is there a standard for * and & placement style?
  5. X-Nntp-Posting-Host: inet-gw
  6. Content-Type: text/plain; charset=us-ascii
  7. Message-ID: <312E2E06.5582@data-io.com>
  8. Sender: news@data-io.com (Usenet news)
  9. Content-Transfer-Encoding: 7bit
  10. Organization: Data I/O Corp.
  11. References: <3128BD31.4AF8@wildfire.com> <4gfm7n$1an@news.voicenet.com>
  12. Mime-Version: 1.0
  13. Date: Fri, 23 Feb 1996 21:13:42 GMT
  14. X-Mailer: Mozilla 2.0 (Win95; I)
  15.  
  16. Peter Kobak wrote:
  17. > In message <marnoldDn27q9.Is0@netcom.com> - marnold@netcom.com (Matt Arnold)
  18. > writes:
  19. > :>
  20. > :>Stonewall Ballard <stoney@wildfire.com> writes:
  21. > :>
  22. > :>>I'm trying to find out whether there is a "standard" for the
  23. > :>>placement of * and &. A survey of C++ texts shows that most use
  24. > :>
  25. > :>>Form 1
  26. > :>>  int&  foo;
  27. > :>>  int*  foo;
  28. > :>
  29. > :>>while some use
  30. > :>
  31. > :>>Form 2
  32. > :>>  int&  foo;
  33. > :>>  int  *foo;
  34. > :>
  35. > :>There is probably no standard, just religiously held opinions.
  36. > :>
  37. > After you settle this :-), how about where to put the 'const':
  38. > A const& a;
  39. > A const &a;
  40. > const A& a;
  41. > const A &a;
  42. > ================
  43. > Peter Kobak
  44. > kobak@voicenet.com
  45.  
  46. const A     *a //  the pointer a is allowed to change
  47. A* const     a //  the pointer is to be declared as constant
  48. const A* const      a //  the pointer as well as the object pointed to as  
  49.                        constant
  50.  
  51. personally I preferred     const A        *a, *b, *c  :-)
  52.  
  53. Meiyu Lin
  54. linm@data-io.com
  55.